/*
 *	The temperature program prints table for fahrenheit-celsius 
 *	and celsius-fahrenheit.
 *	Copyright (C) 1989-2089 Sergey Sergeevich Tsybanov All Rights Reserved
 *
 *	Temperature is free software: you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation, either version 3 of the License, or
 *	(at your option) any later version.
 *
 *	Temperature is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License 
 *	along with the temperature program. 
 *	If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef TEMPERATURE_H

#include <stdio.h>
#include "boolean.h"

#define TEMPERATURE_H

/*
 *	Defines the hexadecimal to clear the most significant bit.
 */
#ifndef CLEAR_MOST_SIGNIFICANT_BIT
#define CLEAR_MOST_SIGNIFICANT_BIT 0x7FFFFFFFFFFFFFFF
#endif

/*
 *	Defines the INLINE macro with the strictest compiler inline macro.
 */
#ifndef INLINE
#define INLINE __attribute__((always_inline))
#endif

/*
 *	MATH_DECIMAL defines the floating-point precision type.
 */
#ifndef MATH_DECIMAL
#define MATH_DECIMAL double
#endif

/*
 *	MATH_INTEGER defines the integer type.
 */
#ifndef MATH_INTEGER
#define MATH_INTEGER long long
#endif

/*
 *	The absoluteValue function takes as an input a MATH_DECIMAL and 
 *	returns a MATH_DECIMAL. The input MATH_DECIMAL converts to a 
 *	MATH_INTEGER, the most significant bit clears with a mask to remove 
 *	the negative sign and the MATH_INTEGER converts back to a 
 *	MATH_DECIMAL before returning the MATH_DECIMAL.
 */
MATH_DECIMAL absoluteValue( MATH_DECIMAL x);

/*
 *	Takes as input a boolean determining whether the conversion is from 
 *	Celsius to Fahrenheit, a MATH_DECIMAL value signifying the start 
 *	temperature value, a MATH_DECIMAL value signifying the end 
 *	temperature value and a MATH_DECIMAL value signifying the 
 *	incrementation magnitude of the temperature values. Prints a table 
 *	for fahrenheit-celsius and celsius-fahrenheit.
 */
void printTemperature( bool isCelsius, MATH_DECIMAL start, 
			MATH_DECIMAL end, MATH_DECIMAL step);

#endif